﻿#ifndef PST_TXTTO2DSURFACEGENERATOR_H
#define PST_TXTTO2DSURFACEGENERATOR_H

#include <vtkSmartPointer.h>  

#include <QWidget>
#include <QString>

class vtkTable;
class vtkActor;
class vtkScalarBarActor;
class vtkLookupTable;

namespace pst
{
    class TxtTo2DSurfaceGenerator :public QObject
    {
        Q_OBJECT

    public:
        explicit TxtTo2DSurfaceGenerator(QObject* parent = 0);

        void setFilename(const QString& filename);
        QString getFilename() const;

        bool update();
        vtkSmartPointer<vtkActor> getActor();
        vtkSmartPointer<vtkScalarBarActor> getScalarBar();

    private:
        bool readCSV(const QString& filename);
        void createVTKPolyData();
        vtkSmartPointer<vtkLookupTable> createLookupTable();
        void createScalarBar();

    private:
        vtkSmartPointer<vtkTable> m_dataTable;
        vtkSmartPointer<vtkActor> m_actor;
        vtkSmartPointer<vtkScalarBarActor> m_scalarBar;
        vtkSmartPointer<vtkLookupTable> m_lookupTable;
        double m_scalarRange[2];
        QString m_filename;
    };
}

#endif
